/*
 * Copyright (c) 2008, Xiong Yingfei, the University of Tokyo
 * All rights reserved.
 */
package ac.jp.u_tokyo.SyncLib.references;

public class ExistingReference extends Reference
{
	protected Object _obj;

	public ExistingReference(Object obj)
	{
		super();
		_obj = obj;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((_obj == null) ? 0 : _obj.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj) return true; 
		if (obj == null) return false;
		if (getClass() != obj.getClass()) return false;
		final ExistingReference other = (ExistingReference) obj;
		return this._obj == other._obj;
	}

	@Override
	public String toString()
	{
		return "{ref:" + _obj.toString() + "}";
	}

	public Object getRef()
	{
		return _obj;
	}
	
	

}
